package com.wm.homework01;

public class Text {
    public static void main(String[] args) {
        Animal a = new Cat();
        Text t = new Text();
        a.eat();
        a.cry();
        t.text(a);
        System.out.println("*****************");
        a = new Dog();
        a.eat();
        a.cry();
        t.text(a);
        System.out.println("*****************");
        a = new Eagle();
        a.eat();
        a.cry();
        t.text(a);

    }
    public void text(Animal animal){
        if (animal instanceof Cat){
            Cat cat = (Cat)animal;
            cat.catchMouse();
        }else if (animal instanceof Dog){
            Dog dog = (Dog) animal;
            dog.lookHouse();
        }else if (animal instanceof Eagle){
            Eagle eagle = (Eagle)animal;
            eagle.hunt();
        }
    }
}
